#ifndef DIRECTMESSAGECREATOR_H
#define DIRECTMESSAGECREATOR_H

#include "fanfou_global.h"
#include "data/FanfouUser.h"
#include <QObject>
class QNetworkReply;
namespace TWCore
{
	class MailCreatorDialog;
}
namespace Fanfou
{
	class FanfouUser;
	class FanfouContext;
	class DirectMessageCreator : public QObject
	{
		Q_OBJECT
		public:
			DirectMessageCreator(FanfouContext*);
			void sendMessage(const FanfouUser&,const FanfouId& replyId = QString());
			void setAutoClose(bool b) { b_autoClose = b; }

		private slots:
			void freeResource(const FanfouUser& = FanfouUser());
			void iconAvailable();
			void onPostFinished();
			void onSendBtnClicked(const QString&,const QString&);
		private:
			FanfouUser m_currentReceiver;
			FanfouContext* m_context;
			TWCore::MailCreatorDialog* m_dialog;
			bool b_autoClose;
			bool b_waitingForUserIcon;
			FanfouId s_replyId;
			QNetworkReply* m_sendMailReply;
	};

} // namespace Fanfou

#endif // DIRECTMESSAGECREATOR_H
